# https://desk.3gbizhi.com/ 36壁纸

import time
from DrissionPage import SessionPage

# 创建页面对象
page = SessionPage()

# 爬取3页
for i in range(1, 4):
    # 访问某一页的网页
    page.get(f'https://desk.3gbizhi.com/deskZW/index_{i}.html')
    time.sleep(1)

    links = page.eles('xpath://li[@class="box_black"]//img')
    for link in links:
        img_url = link.attr("lay-src")
        name = link.attr("alt")
        # 执行下载
        page.download(img_url, r'.\植物', rename=name)


